package com.cjr.seataproduct.controller;

import com.cjr.seataproduct.dao.OperateProductMapper;
import com.cjr.seataproduct.entity.Product;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/product")
public class OperateProductController {
    @Resource
    OperateProductMapper operateProductMapper;

    @RequestMapping("/update")
    public String update(){
        int count = operateProductMapper.selectCount();
        Product product = new Product();
        product.setProductId(88);
        product.setCount(--count);
        operateProductMapper.updateProduct(product);
        return "update success";
    }
}
